import request from '@/utils/request'

// 用户数据传输对象类型定义
export interface UserDTO {
  userId?: number
  username: string
  name: string
  roleId: number
  phone: string
  department: string
  password?: string
}

// 用户查询参数类型定义
export interface UserQueryDTO {
  pageNum: number
  pageSize: number
  username?: string
  department?: string
}

// 添加员工
export const addUsersService = (user: UserDTO) => {
  return request.post('/admin/addUsers', user)
}

// 分页查询员工信息
export const queryUsersService = (params: UserQueryDTO) => {
  return request.get('/admin/queryUsers', { params })
}

// 修改员工信息
export const updateUsersService = (user: UserDTO) => {
  return request.put('/admin/updateUsers', user)
}

// 重置密码
export const resetPasswordService = (userName: string) => {
  return request.put('/admin/resetPassword', null, {
    params: { userName }
  })
}